<!DOCTYPE html>
<html>
  <head>
    <title>满福堂</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
      <link rel="stylesheet" href="${s.base}/mobile/base/css/weui.min.css">
      <link rel="stylesheet" href="${s.base}/mobile/base/css/jquery-weui.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/base.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/index.css">
      <link rel="stylesheet" href="${s.base}/mobile/wechat/css/component.css">
      <style type="text/css">
          .searchTitle{width:96%; padding:0.4rem 2%;line-height: 1.2rem; height: 1.2rem; font-size: 16px; color: #000000; font-weight: bold;}
          .searchContent{width:96%; padding:0rem 2%;}
          .searchContent_value{width:auto; padding:0px 0.6rem; line-height: 1.2rem; height: 1.2rem; border-radius: 0.6rem; font-size: 14px; color: #000000; background: #e3e3e3; float: left; margin: 0.2rem 0.4rem 0.2rem 0px;}
      </style>
  </head>
  <body>
  <div class="xyg-search">

	  <div class="xyg-search-right">
	  	<div class="xyg-search-right-content">
	  		<div class="xyg-search-right-content-icon">
	  			<svg class="icon" aria-hidden="true">
                        <use xlink:href="#iconsousuo">
                        </use>
                    </svg>
	  		</div>
	  		<input type="text" placeholder="请输入楼盘名称" id="searchInput"/>
	  		<div class="clearBoth"></div>
	  	</div>
	  </div>
      <div class="xyg-search-left">
          <span onclick="goFistPage('${memberId}')">取消</span>
      </div>
	  <div class="clearBoth"></div>
  </div>

  <div id="search">
  <div class="searchTitle">&nbsp;热门搜索</div>
  <div class="searchContent">
      <#list hostSearchList as hostSearch>
          <div onclick="inputTitle('${hostSearch.name}')" class="searchContent_value">${hostSearch.name}</div>
      </#list>
      <div class="clearBoth"></div>
  </div>
  </div>
    <div class="xyg-article">


    </div>
    <!--课程内容结束-->
  </div>

  </body>
  <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  <script src="${s.base}/mobile/base/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/base/js/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/base/js/swiper.js" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/base/js/component.js?12323434323232323232" type="text/javascript" charset="utf-8"></script>
  <script src="${s.base}/mobile/wechat/fonts/iconfont.js"></script>
  <script src="${s.base}/mobile/wechat/js/window_port.js"></script>
  <script src="${s.base}/mobile/wechat/js/base.js"></script>

  <!--js分享代码开始-->
  <input type="hidden" value="${jSTicketShareResponse.appid}" id="appid" />
  <input type="hidden" value="${jSTicketShareResponse.fxTitle}" id="fxTitle" />
  <input type="hidden" value="${jSTicketShareResponse.fxImgUrl}" id="fxImgUrl" />
  <input type="hidden" value="${jSTicketShareResponse.fxDesc}" id="fxDesc" />
  <input type="hidden" value="${jSTicketShareResponse.fxUrl}" id="fxUrl" />
  <input type="hidden" value="${jSTicketShareResponse.nonceStr}" id="nonceStr" />
  <input type="hidden" value="${jSTicketShareResponse.timestamp}" id="timestamp" />
  <input type="hidden" value="${jSTicketShareResponse.signature}" id="signature" />
  <script src="${s.base}/mobile/base/js/share.js"></script>
  <script type="text/javascript">
      var currentCityId='${cityId}';
      var memberId='${memberId}';
      var name='';
      var pageNum = 0;
      var pageSize = 5;
      var loading = false;  //状态标记
      var isDestroy = false;  //状态标记


      function inputTitle(value) {
          name=value;
          $("#searchInput").val(value);
          change();
      }

      $("#searchInput").bind("propertychange input",function(){
          name=$(this).val();
          change();
       })

      function change() {
          $(".xyg-article").html("");
          if(name==""||name==null){
              $("#search").show();
          }else{
              $("#search").hide();
              pageNum=0;
              if(!isDestroy){
                  sendPost();
              }else{
                  isDestroy = false;
                  $(document.body).infinite().on("infinite", function () {
                      if (loading) return;
                      loading = true;
                      sendPost();
                  });
                  sendPost();
              }
          }
      }

      function sendPost() {
          pageNum++;
          $.fn.postMethodAll("/weChat/hostItem/page",{'pageNum':pageNum,'pageSize':pageSize,'cityId':currentCityId,'name':name},function (result) {
              if (result.data != null && result.data.length > 0) {
                  result.data.forEach(function (item,key,mapObj) {
                      var str='<div class="xyg-article-item borderBottom" onclick="goXqPage(\''+memberId+'\',\''+item.id+'\')">'+
                          '<div class="xyg-article-item-pic">'+
                          '<img src="'+item.coverImage+'" style="width: 96%; height: 100%;"/>'+
                          '</div>'+
                          '<div class="xyg-article-item-content">'+
                          '<div class="xyg-article-item-content-title font-grade-one">'+item.name+'</div>'+
                          '<div class="xyg-article-item-content-author">'+item.cityName+'-'+item.areaName+'<div style="float: right;">'+item.price+'元/m2</div></div>'+
                          '<div class="xyg-article-item-content-author">'+
                          item.minRooms+'-'+item.maxRooms+'室&nbsp;|&nbsp;'+item.minApartmentArea+'-'+item.maxApartmentArea+'m2<!--<div style="float: right;font-size: 16px; font-weight: bold; color: #ff6669;">125万</div>-->'+
                          '</div><div class="xyg-article-item-content-tag">';
                      if(item.tag!=null&&item.tag!=""&&item.tag!="null"){
                          var tags=item.tag.split(",");
                          for(var i=0;i<tags.length;i++){
                              str+='<div class="xyg-article-item-content-tag-title">'+tags[i]+'</div>';
                          }
                      }
                      str+='</div>';

                      if(item.userLogo!=null&&item.userLogo!=""){
                          str+='<div class="xyg-article-item-content-user">'+
                              '<img src="'+item.userLogo+'"/>&nbsp;'+item.userName+'发布楼盘信息</div>';
                      }
                      str+='</div>'+
                          '<div class="clearBoth"></div>'+
                          '</div>';
                      $(".xyg-article").append(str);
                  });
                  loading = false;
                  if (!result.hasNextPage) {
                      $(document.body).destroyInfinite();
                      isDestroy=true;
                  }
              } else {
                  $(document.body).destroyInfinite();
                  isDestroy=true;
              }
          });
      }
  </script>

</html>

